// import Toolbar from "@/components/ViewComponents/Toolbar";
import { useTranslation } from "react-i18next";
import { BasicTable, useTable, BasicColumn, FormSchema, useRender } from "@/components/Table";
import { applyIndicatorPage } from "@/api/MedicalExamination";
import { getAge } from "@/utils/helper/dataHelper";

export default function Approved_exceeding() {
	const { t } = useTranslation();
	const formSchemaTop: FormSchema[] = [
		{
			label: t("felix_ui.date_from"),
			field: "date_from",
			component: "DatePicker",
			colProps: { span: 6 }
		},
		{
			label: t("felix_ui.date_to"),
			field: "date_to",
			component: "DatePicker",
			colProps: { span: 6 }
		},
		{
			label: t("felix_ui.cli_name"),
			field: "cli_name",
			component: "Select",
			componentProps: {
				options: [
					{ label: "1", value: "1" },
					{ label: "2", value: "2" }
				]
			},
			colProps: { span: 4 }
		},
		{
			label: "subject",
			field: "subject",
			component: "Select",
			componentProps: {
				options: [
					{ label: "1", value: "1" },
					{ label: "2", value: "2" }
				]
			},
			colProps: { span: 4 }
		}
	];
	const columns: BasicColumn[] = [
		{
			title: t("felix_ui.dt_date"),
			dataIndex: "createdTime",
			width: 150,
			render: text => (text ? useRender.renderDate(text) : "")
		},
		{
			title: t("patientBasic.patient_id"),
			dataIndex: "patient_id",
			render: (_, record) => (record.patients ? record.patients.patientId : "")
		},
		{
			title: t("patientBasic.full_name"),
			dataIndex: "full_name",
			render: (_, record) => (record.patients ? record.patients.fullName : "")
		},
		{
			title: t("patientBasic.birthyear"),
			dataIndex: "birthyear",
			render: (_, record) => (record.patients ? getAge(record.patients.birthday) : "")
		},
		{
			title: t("felix_ui.rx_diagnosis"),
			dataIndex: "rx_diagnosis",
			render: (_, record) => (record.diagnosis ? record.diagnosis.rxDiagnosis : "")
		},
		{
			title: t("felix_ui.doctor_id"),
			dataIndex: "doctorName"
		},
		{
			title: t("felix_ui.clinic_name"),
			dataIndex: "deptName"
		},
		{
			title: t("felix_ui.approve"),
			dataIndex: "status",
			render: text => useRender.renderDict(text, "review_status")
		}
	];
	const [formTop] = useTable({
		// dataSource: [
		// 	{
		// 		dt_date: "2025-01-13",
		// 		patient_id: "001",
		// 		full_name: "张三",
		// 		birthyear: "男",
		// 		rx_diagnosis: "感冒",
		// 		doctor_id: "王医生",
		// 		clinic_name: "门诊部门",
		// 		approve: "1"
		// 	}
		// ],
		api: applyIndicatorPage,
		columns,
		formConfig: {
			labelWidth: 100,
			schemas: formSchemaTop,
			showActionButtonGroup: true
		},
		useSearchForm: true
	});
	return (
		<div className="Approved_exceeding">
			<div className="page-content">
				<BasicTable register={formTop}></BasicTable>
			</div>
			{/* <Toolbar btnList={["search", "edit", "end"]} /> */}
		</div>
	);
}
